<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MRSL JPS3D Library: include/jps_planner/jps_planner/graph_search.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MRSL JPS3D Library
   &#160;<span id="projectnumber">1.1</span>
   </div>
   <div id="projectbrief">An implementaion of Jump Point Search on 3D voxel map</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_6810188cd2ea088282d3e2870d3170c6.html">jps_planner</a></li><li class="navelem"><a class="el" href="dir_78791bf993c4f7547ae15e7c34d4eefe.html">jps_planner</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">graph_search.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#ifndef JPS_GRAPH_SEARCH_H</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#define JPS_GRAPH_SEARCH_H</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;boost/heap/d_ary_heap.hpp&gt;</span>      <span class="comment">// boost::heap::d_ary_heap</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span>                         <span class="comment">// std::shared_ptr</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;limits&gt;</span>                         <span class="comment">// std::numeric_limits</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span>                         <span class="comment">// std::vector</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span>                  <span class="comment">// std::unordered_map</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceJPS.html">JPS</a></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;{</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;</div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="structJPS_1_1compare__state.html">   19</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="structJPS_1_1compare__state.html">compare_state</a></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;  {</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <span class="keywordtype">bool</span> operator()(T a1, T a2)<span class="keyword"> const</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;      <span class="keywordtype">double</span> f1 = a1-&gt;g + a1-&gt;h;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;      <span class="keywordtype">double</span> f2 = a2-&gt;g + a2-&gt;h;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;      <span class="keywordflow">if</span>( ( f1 &gt;= f2 - 0.000001) &amp;&amp; (f1 &lt;= f2 +0.000001) )</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <span class="keywordflow">return</span> a1-&gt;g &lt; a2-&gt;g; <span class="comment">// if equal compare gvals</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;      <span class="keywordflow">return</span> f1 &gt; f2;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    }</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  };</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;  <span class="keyword">struct </span><a class="code" href="structJPS_1_1State.html">State</a>; <span class="comment">// forward declaration</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment"></span>  <span class="keyword">using</span> StatePtr = std::shared_ptr&lt;State&gt;;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  <span class="keyword">using</span> priorityQueue = boost::heap::d_ary_heap&lt;StatePtr, boost::heap::mutable_&lt;true&gt;,</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                        boost::heap::arity&lt;2&gt;, boost::heap::compare&lt; compare_state&lt;StatePtr&gt; &gt;&gt;;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html">   40</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="structJPS_1_1State.html">State</a></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;  {</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a12b7e5ae25094c25bcb5e5dedfcbf576">   43</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structJPS_1_1State.html#a12b7e5ae25094c25bcb5e5dedfcbf576">id</a>;</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a365c33bb80f59adc38adc5c92309a9e4">   45</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structJPS_1_1State.html#a365c33bb80f59adc38adc5c92309a9e4">x</a>, y, z = 0;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#afaa913dcc116c136a292f5297899f8b8">   47</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structJPS_1_1State.html#afaa913dcc116c136a292f5297899f8b8">dx</a>, dy, dz;                            <span class="comment">// discrete coordinates of this node</span></div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a4b66f81604569c64048119fcd9fd04ec">   49</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">int</span> parentId = -1;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#abf96d238c1b7ecd569f8ab01c0945712">   52</a></span>&#160;    priorityQueue::handle_type <a class="code" href="structJPS_1_1State.html#abf96d238c1b7ecd569f8ab01c0945712">heapkey</a>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a1d2798ded4f56d41a29152d5a401163d">   55</a></span>&#160;    <span class="keywordtype">double</span> g = std::numeric_limits&lt;double&gt;::infinity();</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#aac7a7ca5b583f599cd129243c73de59d">   57</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="structJPS_1_1State.html#aac7a7ca5b583f599cd129243c73de59d">h</a>;</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a43b5adc47eed218e844b62e14bd90863">   59</a></span>&#160;    <span class="keywordtype">bool</span> opened = <span class="keyword">false</span>;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#aa56de0397bc14c03ed5c3311f5710b43">   61</a></span>&#160;    <span class="keywordtype">bool</span> closed = <span class="keyword">false</span>;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a574a1c732c40b943df83fcb7c3726473">   64</a></span>&#160;    <a class="code" href="structJPS_1_1State.html#a574a1c732c40b943df83fcb7c3726473">State</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy )</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;      : id(id), x(x), y(y), dx(dx), dy(dy)</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    {}</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="structJPS_1_1State.html#a3aa15ff70720179c76d025808d76c300">   69</a></span>&#160;    <a class="code" href="structJPS_1_1State.html#a3aa15ff70720179c76d025808d76c300">State</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> dz )</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;      : id(id), x(x), y(y), z(z), dx(dx), dy(dy), dz(dz)</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    {}</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  };</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structJPS_1_1JPS2DNeib.html">   76</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="structJPS_1_1JPS2DNeib.html">JPS2DNeib</a> {</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="comment">// for each (dx,dy) these contain:</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">//    ns: neighbors that are always added</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="comment">//    f1: forced neighbors to check</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="comment">//    f2: neighbors to add if f1 is forced</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordtype">int</span> ns[9][2][8];</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keywordtype">int</span> f1[9][2][2];</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="keywordtype">int</span> f2[9][2][2];</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="comment">// nsz contains the number of neighbors for the four different types of moves:</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="comment">// no move (norm 0):        8 neighbors always added</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="comment">//                          0 forced neighbors to check (never happens)</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="comment">//                          0 neighbors to add if forced (never happens)</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment">// straight (norm 1):       1 neighbor always added</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="comment">//                          2 forced neighbors to check</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="comment">//                          2 neighbors to add if forced</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="comment">// diagonal (norm sqrt(2)): 3 neighbors always added</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="comment">//                          2 forced neighbors to check</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="comment">//                          2 neighbors to add if forced</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keyword">static</span> constexpr <span class="keywordtype">int</span> nsz[3][2] = {{8, 0}, {1, 2}, {3, 2}};</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keywordtype">void</span> print();</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <a class="code" href="structJPS_1_1JPS2DNeib.html">JPS2DNeib</a>();</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordtype">void</span> Neib(<span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> norm1, <span class="keywordtype">int</span> dev, <span class="keywordtype">int</span>&amp; tx, <span class="keywordtype">int</span>&amp; ty);</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordtype">void</span> FNeib(<span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> norm1, <span class="keywordtype">int</span> dev,</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <span class="keywordtype">int</span>&amp; fx, <span class="keywordtype">int</span>&amp; fy, <span class="keywordtype">int</span>&amp; nx, <span class="keywordtype">int</span>&amp; ny);</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  };</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div><div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="structJPS_1_1JPS3DNeib.html">  106</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="structJPS_1_1JPS3DNeib.html">JPS3DNeib</a> {</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="comment">// for each (dx,dy,dz) these contain:</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="comment">//    ns: neighbors that are always added</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="comment">//    f1: forced neighbors to check</span></div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="comment">//    f2: neighbors to add if f1 is forced</span></div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordtype">int</span> ns[27][3][26];</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordtype">int</span> f1[27][3][12];</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="keywordtype">int</span> f2[27][3][12];</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="comment">// nsz contains the number of neighbors for the four different types of moves:</span></div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="comment">// no move (norm 0):        26 neighbors always added</span></div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="comment">//                          0 forced neighbors to check (never happens)</span></div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="comment">//                          0 neighbors to add if forced (never happens)</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="comment">// straight (norm 1):       1 neighbor always added</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="comment">//                          8 forced neighbors to check</span></div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="comment">//                          8 neighbors to add if forced</span></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="comment">// diagonal (norm sqrt(2)): 3 neighbors always added</span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="comment">//                          8 forced neighbors to check</span></div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="comment">//                          12 neighbors to add if forced</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="comment">// diagonal (norm sqrt(3)): 7 neighbors always added</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="comment">//                          6 forced neighbors to check</span></div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="comment">//                          12 neighbors to add if forced</span></div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    <span class="keyword">static</span> constexpr <span class="keywordtype">int</span> nsz[4][2] = {{26, 0}, {1, 8}, {3, 12}, {7, 12}};</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <a class="code" href="structJPS_1_1JPS3DNeib.html">JPS3DNeib</a>();</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    <span class="keywordtype">void</span> Neib(<span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> dz, <span class="keywordtype">int</span> norm1, <span class="keywordtype">int</span> dev, <span class="keywordtype">int</span>&amp; tx, <span class="keywordtype">int</span>&amp; ty, <span class="keywordtype">int</span>&amp; tz);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="keywordtype">void</span> FNeib( <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> dz, <span class="keywordtype">int</span> norm1, <span class="keywordtype">int</span> dev,</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="keywordtype">int</span>&amp; fx, <span class="keywordtype">int</span>&amp; fy, <span class="keywordtype">int</span>&amp; fz,</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        <span class="keywordtype">int</span>&amp; nx, <span class="keywordtype">int</span>&amp; ny, <span class="keywordtype">int</span>&amp; nz);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  };</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="classJPS_1_1GraphSearch.html">  142</a></span>&#160;  <span class="keyword">class </span><a class="code" href="classJPS_1_1GraphSearch.html">GraphSearch</a></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;  {</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;      <a class="code" href="classJPS_1_1GraphSearch.html">GraphSearch</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* cMap, <span class="keywordtype">int</span> xDim, <span class="keywordtype">int</span> yDim, <span class="keywordtype">double</span> eps = 1, <span class="keywordtype">bool</span> verbose = <span class="keyword">false</span>);</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;      <a class="code" href="classJPS_1_1GraphSearch.html">GraphSearch</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* cMap, <span class="keywordtype">int</span> xDim, <span class="keywordtype">int</span> yDim, <span class="keywordtype">int</span> zDim, <span class="keywordtype">double</span> eps = 1, <span class="keywordtype">bool</span> verbose = <span class="keyword">false</span>);</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;      <span class="keywordtype">bool</span> plan(<span class="keywordtype">int</span> xStart, <span class="keywordtype">int</span> yStart, <span class="keywordtype">int</span> xGoal, <span class="keywordtype">int</span> yGoal, <span class="keywordtype">bool</span> useJps, <span class="keywordtype">int</span> maxExpand = -1);</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;      <span class="keywordtype">bool</span> plan(<span class="keywordtype">int</span> xStart, <span class="keywordtype">int</span> yStart, <span class="keywordtype">int</span> zStart, <span class="keywordtype">int</span> xGoal, <span class="keywordtype">int</span> yGoal, <span class="keywordtype">int</span> zGoal, <span class="keywordtype">bool</span> useJps, <span class="keywordtype">int</span> maxExpand = -1);</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;      std::vector&lt;StatePtr&gt; getPath() <span class="keyword">const</span>;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;      std::vector&lt;StatePtr&gt; getOpenSet() <span class="keyword">const</span>;</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;      std::vector&lt;StatePtr&gt; getCloseSet() <span class="keyword">const</span>;</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;      std::vector&lt;StatePtr&gt; getAllSet() <span class="keyword">const</span>;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;      <span class="keywordtype">bool</span> plan(StatePtr&amp; currNode_ptr, <span class="keywordtype">int</span> max_expand, <span class="keywordtype">int</span> start_id, <span class="keywordtype">int</span> goal_id);</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;      <span class="keywordtype">void</span> getSucc(<span class="keyword">const</span> StatePtr&amp; curr, std::vector&lt;int&gt;&amp; succ_ids, std::vector&lt;double&gt;&amp; succ_costs);</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;      <span class="keywordtype">void</span> getJpsSucc(<span class="keyword">const</span> StatePtr&amp; curr, std::vector&lt;int&gt;&amp; succ_ids, std::vector&lt;double&gt;&amp; succ_costs);</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;      std::vector&lt;StatePtr&gt; recoverPath(StatePtr node, <span class="keywordtype">int</span> <span class="keywordtype">id</span>);</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;      <span class="keywordtype">int</span> coordToId(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) <span class="keyword">const</span>;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;      <span class="keywordtype">int</span> coordToId(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z) <span class="keyword">const</span>;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;      <span class="keywordtype">bool</span> isFree(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) <span class="keyword">const</span>;</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;      <span class="keywordtype">bool</span> isFree(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z) <span class="keyword">const</span>;</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;      <span class="keywordtype">bool</span> isOccupied(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) <span class="keyword">const</span>;</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;      <span class="keywordtype">bool</span> isOccupied(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z) <span class="keyword">const</span>;</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;      <span class="keywordtype">double</span> getHeur(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) <span class="keyword">const</span>;</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;      <span class="keywordtype">double</span> getHeur(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z) <span class="keyword">const</span>;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;      <span class="keywordtype">bool</span> hasForced(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy);</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;      <span class="keywordtype">bool</span> hasForced(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> dz);</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;      <span class="keywordtype">bool</span> jump(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span>&amp; new_x, <span class="keywordtype">int</span>&amp; new_y);</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;      <span class="keywordtype">bool</span> jump(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <span class="keywordtype">int</span> dz, <span class="keywordtype">int</span>&amp; new_x, <span class="keywordtype">int</span>&amp; new_y, <span class="keywordtype">int</span>&amp; new_z);</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;      <span class="keywordtype">void</span> init2DJps();</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;      <span class="keyword">const</span> <span class="keywordtype">char</span>* cMap_;</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;      <span class="keywordtype">int</span> xDim_, yDim_, zDim_;</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;      <span class="keywordtype">double</span> eps_;</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;      <span class="keywordtype">bool</span> verbose_;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;      <span class="keyword">const</span> <span class="keywordtype">char</span> val_free_ = 0;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;      <span class="keywordtype">int</span> xGoal_, yGoal_, zGoal_;</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;      <span class="keywordtype">bool</span> use_2d_;</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;      <span class="keywordtype">bool</span> use_jps_ = <span class="keyword">false</span>;</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;      priorityQueue pq_;</div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;      std::vector&lt;StatePtr&gt; hm_;</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;      std::vector&lt;bool&gt; seen_;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;      std::vector&lt;StatePtr&gt; path_;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;      std::vector&lt;std::vector&lt;int&gt;&gt; ns_;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;      std::shared_ptr&lt;JPS2DNeib&gt; jn2d_;</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;      std::shared_ptr&lt;JPS3DNeib&gt; jn3d_;</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160; };</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;}</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="structJPS_1_1State_html_aac7a7ca5b583f599cd129243c73de59d"><div class="ttname"><a href="structJPS_1_1State.html#aac7a7ca5b583f599cd129243c73de59d">JPS::State::h</a></div><div class="ttdeci">double h</div><div class="ttdoc">heuristic cost </div><div class="ttdef"><b>Definition:</b> graph_search.h:57</div></div>
<div class="ttc" id="namespaceJPS_html"><div class="ttname"><a href="namespaceJPS.html">JPS</a></div><div class="ttdef"><b>Definition:</b> map_util.h:11</div></div>
<div class="ttc" id="structJPS_1_1State_html_a574a1c732c40b943df83fcb7c3726473"><div class="ttname"><a href="structJPS_1_1State.html#a574a1c732c40b943df83fcb7c3726473">JPS::State::State</a></div><div class="ttdeci">State(int id, int x, int y, int dx, int dy)</div><div class="ttdoc">2D constructor </div><div class="ttdef"><b>Definition:</b> graph_search.h:64</div></div>
<div class="ttc" id="structJPS_1_1State_html_a365c33bb80f59adc38adc5c92309a9e4"><div class="ttname"><a href="structJPS_1_1State.html#a365c33bb80f59adc38adc5c92309a9e4">JPS::State::x</a></div><div class="ttdeci">int x</div><div class="ttdoc">Coord. </div><div class="ttdef"><b>Definition:</b> graph_search.h:45</div></div>
<div class="ttc" id="structJPS_1_1JPS2DNeib_html"><div class="ttname"><a href="structJPS_1_1JPS2DNeib.html">JPS::JPS2DNeib</a></div><div class="ttdoc">Search and prune neighbors for JPS 2D. </div><div class="ttdef"><b>Definition:</b> graph_search.h:76</div></div>
<div class="ttc" id="structJPS_1_1State_html_afaa913dcc116c136a292f5297899f8b8"><div class="ttname"><a href="structJPS_1_1State.html#afaa913dcc116c136a292f5297899f8b8">JPS::State::dx</a></div><div class="ttdeci">int dx</div><div class="ttdoc">direction </div><div class="ttdef"><b>Definition:</b> graph_search.h:47</div></div>
<div class="ttc" id="structJPS_1_1JPS3DNeib_html"><div class="ttname"><a href="structJPS_1_1JPS3DNeib.html">JPS::JPS3DNeib</a></div><div class="ttdoc">Search and prune neighbors for JPS 3D. </div><div class="ttdef"><b>Definition:</b> graph_search.h:106</div></div>
<div class="ttc" id="structJPS_1_1compare__state_html"><div class="ttname"><a href="structJPS_1_1compare__state.html">JPS::compare_state</a></div><div class="ttdoc">Heap element comparison. </div><div class="ttdef"><b>Definition:</b> graph_search.h:19</div></div>
<div class="ttc" id="structJPS_1_1State_html_a12b7e5ae25094c25bcb5e5dedfcbf576"><div class="ttname"><a href="structJPS_1_1State.html#a12b7e5ae25094c25bcb5e5dedfcbf576">JPS::State::id</a></div><div class="ttdeci">int id</div><div class="ttdoc">ID. </div><div class="ttdef"><b>Definition:</b> graph_search.h:43</div></div>
<div class="ttc" id="structJPS_1_1State_html_abf96d238c1b7ecd569f8ab01c0945712"><div class="ttname"><a href="structJPS_1_1State.html#abf96d238c1b7ecd569f8ab01c0945712">JPS::State::heapkey</a></div><div class="ttdeci">priorityQueue::handle_type heapkey</div><div class="ttdoc">pointer to heap location </div><div class="ttdef"><b>Definition:</b> graph_search.h:52</div></div>
<div class="ttc" id="classJPS_1_1GraphSearch_html"><div class="ttname"><a href="classJPS_1_1GraphSearch.html">JPS::GraphSearch</a></div><div class="ttdoc">GraphSearch class. </div><div class="ttdef"><b>Definition:</b> graph_search.h:142</div></div>
<div class="ttc" id="structJPS_1_1State_html_a3aa15ff70720179c76d025808d76c300"><div class="ttname"><a href="structJPS_1_1State.html#a3aa15ff70720179c76d025808d76c300">JPS::State::State</a></div><div class="ttdeci">State(int id, int x, int y, int z, int dx, int dy, int dz)</div><div class="ttdoc">3D constructor </div><div class="ttdef"><b>Definition:</b> graph_search.h:69</div></div>
<div class="ttc" id="structJPS_1_1State_html"><div class="ttname"><a href="structJPS_1_1State.html">JPS::State</a></div><div class="ttdoc">Node of the graph in graph search. </div><div class="ttdef"><b>Definition:</b> graph_search.h:40</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
